<?php
namespace app\admin\controller;

use app\common\controller\SysAction;
use think\Db;

class MemberLevel extends SysAction
{
    protected $modelClass = '\app\common\model\MemberLevel';
    
    public function initialize()
    {
        parent::initialize();
    }

    /**
     * @Title: index
     * @Description: todo(会员组列表)
     * @return mixed
     * @author 若谷
     * @date 2019年6月12日
     * @throws
     */
    public function index()
    {
        $dataList = $this->cModel->order("min_grade asc")->paginate('', false, page_param());
    	foreach ($dataList as $key => &$value) {
    		$min = $value['min_grade'];
    		if (isset($dataList[$key+1])) {
    			$max = $dataList[$key+1]['min_grade']-1;
    		}else{
    			$max = '不限';
    		}
    		$value['max_grade'] = $max;
    	}
        $this->assign('dataList', $dataList);
        return $this->fetch();
    }

}